package com.kate.mall.member.service.impl;

import com.kate.mall.common.utils.PageUtils;
import com.kate.mall.common.utils.Query;
import com.kate.mall.member.dao.SysOauthClientDao;
import com.kate.mall.member.entity.MemberEntity;
import com.kate.mall.member.entity.SysOauthClientEntity;
import com.kate.mall.member.service.SysOauthClientService;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

@Service("sysOauthClientService")
public class SysOauthClientServiceImpl extends ServiceImpl<SysOauthClientDao, SysOauthClientEntity> implements SysOauthClientService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<SysOauthClientEntity> page = this.page(
                new Query<SysOauthClientEntity>().getPage(params),
                generatorQueryWrapper(params)
        );

        return new PageUtils(page);
    }
    public QueryWrapper generatorQueryWrapper(Map<String, Object> params) {//is_hot=1
        QueryWrapper<SysOauthClientEntity> queryWrapper = new QueryWrapper<>();
        if (params.containsKey("client_id")) {
            //where is_hot=1
            queryWrapper.eq("client_id", params.get("client_id"));
        }
        return queryWrapper;
    }
}